package structure_结构性.filter_pattern_过滤器模式;

import java.util.ArrayList;

/**
 * Created with IntelliJ IDEA.
 *
 * @Auther: hihi
 * @Date: 2020/07/07/10:14
 * @Description:
 */
public class FilterPatternDemo {
	public static void main(String[] args) {
		ArrayList<Person> people = new ArrayList<>();
		people.add(new Person("zhangsan", "male", "single"));
		people.add(new Person("lisi", "Female", "single"));
		people.add(new Person("wangwu", "male", "Married"));
		people.add(new Person("fengliu", "Female", "single"));
		people.add(new Person("liqi", "male", "single"));
		people.add(new Person("wangba", "male", "Married"));

		System.err.println(new FilterMale().filter(people));
		System.err.println(new FilterSingle().filter(people));
		System.err.println(new AndFilter(new FilterSingle(), new FilterMale()).filter(people));
		System.err.println(new OrFilter(new FilterSingle(), new FilterMale()).filter(people));
	}
}
